package com.qi.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class AppConfig implements WebMvcConfigurer {

    @Autowired
    private LoginIntercept loginIntercept;

    // 拦截所有路径
    // 添加放行条件
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginIntercept).
                addPathPatterns("/**").
                excludePathPatterns("/login/loginUser").
                excludePathPatterns("/login/goLogin").
                excludePathPatterns("/login/register.html").
                excludePathPatterns("/login/insertUser").
                excludePathPatterns("/login/getCode").
                excludePathPatterns("/**/*.css").
                excludePathPatterns("/**/*.jpg").
                excludePathPatterns("/**/*.js");
    }
}
